package com.xiaobias.distributed.pan.service;


import com.xiaobias.distributed.pan.db.service.BaiduUserService;
import com.xiaobias.distributed.pan.seurity.entity.BaiduUser;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;


@Component
public class BaiduPanTokenService {
    @Resource
    private BaiduUserService baiduUserService;

    public String getToken() {
        String uk = ((BaiduUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal()).getUk();
        com.xiaobias.distributed.pan.db.entity.BaiduUser byId = baiduUserService.getById(uk);
        return byId.getToken();
    }
}
